import java.util.ArrayList;

/**
 * created by 赵文韬 on 2023/1/3 0:47
 */
public class Text {
    public static void main(String[] args){
       /* HashMap<Object, Object> map = new HashMap<>();
        map.put(1,11 );
        map.put(2,22 );
        map.put(3,33 );
        map.put(4,44 );
        Iterator<Map.Entry<Object, Object>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<Object, Object> next = iterator.next();
            if (next.getValue().equals(22)){
                map.remove(next.getKey());
            }
        }
        System.out.println(map);*/
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        arrayList.add(5);
        arrayList.add(6);
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i)==2){
                arrayList.remove(i);
            }
        }
        System.out.println(arrayList);
       /* for (Integer o : arrayList) {
            if (o.equals(2)){
                o.
            }*/
        }





}

